package com.vehicle.service.imp;


import com.vehicle.mapper.TotalPriceMapper;
import com.vehicle.service.TotalPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;

@Service
@Transactional
public class TotalPriceServiceImpl implements TotalPriceService {

    @Autowired
    private TotalPriceMapper totalPriceMapper;

    @Override
    public Map<String, Integer> allTotalPrice() {
        Integer totalPrice1 = totalPriceMapper.findTotalPrice1();
        Integer totalPrice2 = totalPriceMapper.findTotalPrice2();
        Integer totalPrice3 = totalPriceMapper.findTotalPrice3();
        Integer totalPrice4 = totalPriceMapper.findTotalPrice4();
        Integer totalPrice5 = totalPriceMapper.findTotalPrice5();
        Integer totalPrice6 = totalPriceMapper.findTotalPrice6();
        Integer totalPrice7 = totalPriceMapper.findTotalPrice7();
        Integer totalPrice8 = totalPriceMapper.findTotalPrice8();
        Map<String, Integer> map = new HashMap<>();
        map.put("totalPrice1",totalPrice1);
        map.put("totalPrice2",totalPrice2);
        map.put("totalPrice3",totalPrice3);
        map.put("totalPrice4",totalPrice4);
        map.put("totalPrice5",totalPrice5);
        map.put("totalPrice6",totalPrice6);
        map.put("totalPrice7",totalPrice7);
        map.put("totalPrice8",totalPrice8);
        return map;
    }

    @Override
    public Map<String, Integer> findAllTotalPriceByCarid(Integer carid) {
        Map<String, Integer> map = new HashMap<>();
        Integer totalPrice1 = totalPriceMapper.findTotalPriceByCarid1(carid);
        Integer totalPrice2 = totalPriceMapper.findTotalPriceByCarid2(carid);
        Integer totalPrice3 = totalPriceMapper.findTotalPriceByCarid3(carid);
        Integer totalPrice4 = totalPriceMapper.findTotalPriceByCarid4(carid);
        Integer totalPrice5 = totalPriceMapper.findTotalPriceByCarid5(carid);
        Integer totalPrice6 = totalPriceMapper.findTotalPriceByCarid6(carid);
        Integer totalPrice7 = totalPriceMapper.findTotalPriceByCarid7(carid);
        Integer totalPrice8 = totalPriceMapper.findTotalPriceByCarid8(carid);
        map.put("totalPrice1",totalPrice1);
        map.put("totalPrice2",totalPrice2);
        map.put("totalPrice3",totalPrice3);
        map.put("totalPrice4",totalPrice4);
        map.put("totalPrice5",totalPrice5);
        map.put("totalPrice6",totalPrice6);
        map.put("totalPrice7",totalPrice7);
        map.put("totalPrice8",totalPrice8);
        return map;
    }
}
